//
//  LTHomeworkTableViewCell.m
//  LearnTeacher
//
//  Created by zyl_macbookpro on 2024/4/18.
//

#import "LTHomeworkTableViewCell.h"

@implementation LTHomeworkTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.typeLabel.layer.masksToBounds = YES;
    self.typeLabel.layer.borderWidth = 0.5;
    self.typeLabel.layer.borderColor = rgba(255, 92, 0, 1).CGColor;
    
    self.contentV.layer.cornerRadius = 16;
    self.contentV.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.0500].CGColor;
    self.contentV.layer.shadowOffset = CGSizeMake(0,2);
    self.contentV.layer.shadowOpacity = 1;
    
    [self.headerV setAllCornersWithCornerRadius:12];
    [self.contentV setAllCornersWithCornerRadius:12];
    [self.cardV setAllCornersWithCornerRadius:12];
   
    
}
- (IBAction)clickToQuestionDetail:(UIButton *)sender {
    UIViewController *vc = [[UIViewController alloc] initWithClassName:@"LTQuestionDetailsViewController"];
    vc.hidesBottomBarWhenPushed = YES;
    [[UIViewController currentViewController].navigationController pushViewController:vc animated:YES];
}

- (void)setData:(NSDictionary *)data
{
    _data = data;
    LTHomeworkDetailModel *model = [LTHomeworkDetailModel modelWithDictionary:data];
    self.titleLabel.text = model.name;
  
    self.typeLabel.text = model.type.intValue == 1?@"练习":model.type.intValue == 2?@"测试":@"";
    self.typeLabel.hidden = self.typeLabel.text.length == 0;
   
    self.statuesLabel.text = model.isend.intValue == 1?@"已结束":@"进行中";
    self.stopLabel.text = [[model.deadlinetime substringWithRange:NSMakeRange(5, 11)] stringByReplacingOccurrencesOfString:@"-" withString:@"月"];
    self.stopLabel.text = [self.stopLabel.text stringByReplacingOccurrencesOfString:@" " withString:@"日 "];
    
    self.timeLabel.text = [[model.createtime substringWithRange:NSMakeRange(5, 11)] stringByReplacingOccurrencesOfString:@"-" withString:@"月"];
    self.timeLabel.text = [self.timeLabel.text stringByReplacingOccurrencesOfString:@" " withString:@"日 "];
    
    self.memberLabel.text = model.cname;
    self.fromLabel.text = [NSString stringWithFormat:@"%@",model.pname];
}

@end
